package com.niit.controller;

import com.niit.bean.R;
import com.niit.entity.Rating;
import com.niit.service.RatingService;
import com.niit.service.impl.ABTestRatingService;
import com.niit.utils.Constant;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = {"评分接口"})
@RestController
@CrossOrigin
@RequestMapping("/rec/rating")
public class RatingController {
    @Autowired
    private RatingService ratingService;

    @Autowired
    private ABTestRatingService abTestRatingService;

    @PostMapping("rateToProduct")
    public R rateToProduct(@RequestBody Rating rating){
        return ratingService.addRating(rating);
    }

    @GetMapping("rateProductByAB")
    public R rateProductByAB(){
        return abTestRatingService.addRating();
    }
}

